package cn.caixiong.org.domain;

import cn.caixiong.basic.domain.BaseTreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_department")
@ApiModel(value = "部门对象", description = "部门对象参数")
public class Department extends BaseTreeNode<Department> {

    //主键
    @Id
    @ApiModelProperty(value = "ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    //部门编号
    @ApiModelProperty(value = "部门编号")
    //@Size(min = 3, max = 8 ,message = "部门编号不能为空")
    @NotBlank(message = "部门编号不能为空")
    private String sn;
    //部门名称
    @ApiModelProperty(value = "部门名称")
    @NotBlank(message = "部门名称不能为空")
    private String name;
    //部门状态
    private Integer state;
    //部门经理id
    @Column(name = "manager_id")
    private Long managerId;
    //父部们
    @Column(name = "parent_id")
    private Long parentId;
    //
    @Column(name="dir_path")
    private String dirPath;
    //部门经理
    @Transient
    private String managerName;
    //上级部门
    @Transient
    private String parentName;
    //级联显示
    @Transient
    private Long[] parentIds;
}
